package es.xpt.ysf.commons.report.model;

import java.awt.Color;

import net.sf.jasperreports.engine.JRAlignment;
import net.sf.jasperreports.engine.JRImage;
import net.sf.jasperreports.engine.design.JRDesignExpression;
import net.sf.jasperreports.engine.design.JRDesignImage;
import net.sf.jasperreports.engine.design.JRDesignStyle;
import ar.com.fdvs.dj.domain.DynamicReportOptions;
import ar.com.fdvs.dj.domain.Style;
import ar.com.fdvs.dj.domain.constants.Border;
import ar.com.fdvs.dj.domain.constants.Font;
import ar.com.fdvs.dj.domain.constants.HorizontalAlign;
import ar.com.fdvs.dj.domain.constants.Transparency;
import ar.com.fdvs.dj.domain.constants.VerticalAlign;

public class DefaultStyle { // NO_UCD

	public final static Integer[] margin = { 20, 20, 20, 20 }; // Top,Bottom,Left,Right

	public static JRDesignImage formatLogo(JRDesignExpression expression) {
		JRDesignImage logo = new JRDesignImage(null);
		logo.setX(376);
		logo.setY(5);
		logo.setWidth(154);
		logo.setHeight(50);
		logo.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_RIGHT);
		logo.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_TOP);
		logo.setExpression(expression);
		logo.setScaleImage(JRImage.SCALE_IMAGE_CLIP);
		return logo;
	}

	public static JRDesignStyle formatStylePlane() {
		JRDesignStyle stylePlane = new JRDesignStyle();
		stylePlane.setName("DatosPlanosDefecto");
		stylePlane.setFontName("Arial");
		stylePlane.setFontSize(10);
		stylePlane.setPdfFontName("Helvetica");
		stylePlane.setPdfEncoding("Cp1252");
		stylePlane.setPdfEmbedded(false);
		stylePlane.setDefault(true);
		return stylePlane;
	}
	
	public static final Style TITLE_REPORT = new Style();
	static {
		TITLE_REPORT.setName("TITLE_REPORT");
		Font f =Font.ARIAL_BIG_BOLD;
		f.setFontSize(50);
		TITLE_REPORT.setFont(f);
		TITLE_REPORT.setHorizontalAlign(HorizontalAlign.RIGHT);
		TITLE_REPORT.setTransparency(Transparency.TRANSPARENT);
	}
	
	public static final Style TITLE_LOGO = new Style();
	static {
		TITLE_LOGO.setName("TITLE_LOGO");		
		TITLE_LOGO.setHorizontalAlign(HorizontalAlign.LEFT);
		TITLE_LOGO.setTransparency(Transparency.TRANSPARENT);
	}
	
	public static final Style ODD_ROW = new Style();
	static {
		ODD_ROW.setName("ODD_ROW");
		ODD_ROW.setBorder(Border.NO_BORDER);
		Color veryLightGrey = new Color(240, 240, 240);
		ODD_ROW.setBackgroundColor(veryLightGrey);
		ODD_ROW.setTransparency(Transparency.OPAQUE);
	}

	public static final Style DEFAULT_HEADER_COLUMNS = new DynamicReportOptions().getDefaultHeaderStyle();
	static {
		DEFAULT_HEADER_COLUMNS.setName("DEFAULT_HEADER_COLUMNS");
		DEFAULT_HEADER_COLUMNS.setFont(Font.ARIAL_SMALL_BOLD);
		DEFAULT_HEADER_COLUMNS.setHorizontalAlign(HorizontalAlign.CENTER);
		DEFAULT_HEADER_COLUMNS.setBorderBottom(Border.THIN);
		DEFAULT_HEADER_COLUMNS.setVerticalAlign(VerticalAlign.MIDDLE);
		DEFAULT_HEADER_COLUMNS.setTransparency(Transparency.OPAQUE);
	}
	
	public static final Style GROUP_HEADER_COLUMNS = new DynamicReportOptions().getDefaultGroupHeaderStyle();
	static {
		GROUP_HEADER_COLUMNS.setName("GROUP_HEADER_COLUMNS");
		GROUP_HEADER_COLUMNS.setFont(Font.ARIAL_SMALL_BOLD);
		GROUP_HEADER_COLUMNS.setHorizontalAlign(HorizontalAlign.CENTER);
		GROUP_HEADER_COLUMNS.setBorderBottom(Border.THIN);
		GROUP_HEADER_COLUMNS.setVerticalAlign(VerticalAlign.MIDDLE);
		GROUP_HEADER_COLUMNS.setTransparency(Transparency.OPAQUE);
	}
	
	public static final Style ALIGN_LEFT_HEADER =  new DynamicReportOptions().getDefaultHeaderStyle();
	static {	
		ALIGN_LEFT_HEADER.setName("ALIGN_LEFT_HEADER");
		ALIGN_LEFT_HEADER.setHorizontalAlign(HorizontalAlign.LEFT);
		ALIGN_LEFT_HEADER.setFont(Font.ARIAL_SMALL_BOLD);		
		ALIGN_LEFT_HEADER.setBorderBottom(Border.THIN);
		ALIGN_LEFT_HEADER.setVerticalAlign(VerticalAlign.MIDDLE);
		ALIGN_LEFT_HEADER.setTransparency(Transparency.OPAQUE);		
	}
	
	public static final Style ALIGN_LEFT_HEADER_MEDIUM =  new DynamicReportOptions().getDefaultHeaderStyle();
	static {	
		ALIGN_LEFT_HEADER_MEDIUM.setName("ALIGN_LEFT_HEADER_MEDIUM");
		ALIGN_LEFT_HEADER_MEDIUM.setHorizontalAlign(HorizontalAlign.LEFT);
		ALIGN_LEFT_HEADER_MEDIUM.setFont(Font.ARIAL_MEDIUM_BOLD);		
		ALIGN_LEFT_HEADER_MEDIUM.setVerticalAlign(VerticalAlign.MIDDLE);
		ALIGN_LEFT_HEADER_MEDIUM.setTransparency(Transparency.OPAQUE);		
	}
	
	public static final Style ALIGN_CENTER_HEADER =  new DynamicReportOptions().getDefaultHeaderStyle();
	static {
		ALIGN_CENTER_HEADER.setName("ALIGN_CENTER_HEADER");		
		ALIGN_CENTER_HEADER.setFont(Font.ARIAL_SMALL_BOLD);
		ALIGN_CENTER_HEADER.setHorizontalAlign(HorizontalAlign.CENTER);
		ALIGN_CENTER_HEADER.setBorderBottom(Border.THIN);
		ALIGN_CENTER_HEADER.setVerticalAlign(VerticalAlign.MIDDLE);
		ALIGN_CENTER_HEADER.setTransparency(Transparency.OPAQUE);		
	}
	
	public static final Style ALIGN_RIGTH_HEADER =  new DynamicReportOptions().getDefaultHeaderStyle();
	static {
		ALIGN_RIGTH_HEADER.setName("ALIGN_RIGTH_HEADER");		
		ALIGN_RIGTH_HEADER.setFont(Font.ARIAL_SMALL_BOLD);
		ALIGN_RIGTH_HEADER.setHorizontalAlign(HorizontalAlign.RIGHT);
		ALIGN_RIGTH_HEADER.setBorderBottom(Border.THIN);
		ALIGN_RIGTH_HEADER.setVerticalAlign(VerticalAlign.MIDDLE);
		ALIGN_RIGTH_HEADER.setTransparency(Transparency.OPAQUE);		
	}

	public static final Style ALIGN_TOP = new Style();
	static {
		ALIGN_TOP.setName("ALIGN_TOP");
		ALIGN_TOP.setVerticalAlign(VerticalAlign.TOP);
	}

	public static final Style ALIGN_CENTER = new Style();
	static {
		ALIGN_CENTER.setName("ALIGN_CENTER");
		ALIGN_CENTER.setHorizontalAlign(HorizontalAlign.CENTER);
		ALIGN_CENTER.setVerticalAlign(VerticalAlign.TOP);
	}
	
	public static final Style ALIGN_LEFT = new Style();
	static {
		ALIGN_LEFT.setName("ALIGN_LEFT");
		ALIGN_LEFT.setHorizontalAlign(HorizontalAlign.LEFT);
		ALIGN_LEFT.setVerticalAlign(VerticalAlign.TOP);
	}
	
	public static final Style ALIGN_RIGTH = new Style();
	static {
		ALIGN_RIGTH.setName("ALIGN_RIGTH");
		ALIGN_RIGTH.setHorizontalAlign(HorizontalAlign.RIGHT);
		ALIGN_RIGTH.setVerticalAlign(VerticalAlign.TOP);
	} 
	
	public static final Style COLUMN_TITLE1 = new Style();
	static {
		COLUMN_TITLE1.setName("COLUMN_TITLE1");
		Font f =Font.ARIAL_BIG_BOLD;
		f.setFontSize(18);
		COLUMN_TITLE1.setFont(f);
	}

	public static final Style COLUMN_TITLE2 = new Style();
	static {
		COLUMN_TITLE2.setName("COLUMN_TITLE2");
		COLUMN_TITLE2.setFont(Font.ARIAL_MEDIUM_BOLD);
		COLUMN_TITLE2.setHorizontalAlign(HorizontalAlign.RIGHT);
	}

	public static final Style COLUMN_TITLE3 = new Style();
	static {
		COLUMN_TITLE3.setName("COLUMN_TITLE3");
		COLUMN_TITLE3.setFont(Font.ARIAL_MEDIUM_BOLD);
	}

	public static final Style RESULT1 = new Style();
	static {
		RESULT1.setName("RESULT1");
		RESULT1.setFont(Font.ARIAL_MEDIUM_BOLD);
		RESULT1.setHorizontalAlign(HorizontalAlign.RIGHT);
		RESULT1.setBorderTop(Border.THIN);
	}
	
	public static final Style RESULT3 = new Style();
	static {
		RESULT3.setName("RESULT3");
		RESULT3.setFont(Font.ARIAL_MEDIUM_BOLD);
		RESULT3.setHorizontalAlign(HorizontalAlign.CENTER);
		RESULT3.setBorderTop(Border.THIN);
	}
	public static final Style RESULT3_1 = new Style();
	static {
		RESULT3_1.setName("RESULT3_1");
		RESULT3_1.setFont(Font.ARIAL_SMALL_BOLD);
		RESULT3_1.setHorizontalAlign(HorizontalAlign.CENTER);
		RESULT3_1.setBorderTop(Border.THIN);
	}	

	public static final Style RESULT2 = new Style();
	static {
		RESULT2.setName("RESULT2");
		RESULT2.setTransparency(Transparency.TRANSPARENT);
		RESULT2.setVerticalAlign(VerticalAlign.TOP);
	}
	
	public static final Style RESULT4 = new Style();
	static {
		RESULT4.setName("RESULT4");
		RESULT4.setFont(Font.ARIAL_MEDIUM_BOLD);
		RESULT4.setHorizontalAlign(HorizontalAlign.CENTER);
		RESULT4.setBorderTop(Border.DOTTED);
	}
	
	public static final Style RESULT4_1 = new Style();
	static {
		RESULT4_1.setName("RESULT4_1");
		RESULT4_1.setFont(Font.ARIAL_SMALL_BOLD);
		RESULT4_1.setHorizontalAlign(HorizontalAlign.CENTER);
		RESULT4_1.setBorderTop(Border.DOTTED);
	}	
	
	public static final Style RESULT5 = new Style();
	static {
		RESULT5.setName("RESULT5");
		RESULT5.setFont(Font.ARIAL_MEDIUM_BOLD);
		RESULT5.setHorizontalAlign(HorizontalAlign.RIGHT);
		RESULT5.setBorderTop(Border.DOTTED);
	}
	
	public static final Style RESULT_TOTAL = new Style();
	static {
		RESULT_TOTAL.setName("RESULT_TOTAL");		
		RESULT_TOTAL.setFont(Font.ARIAL_MEDIUM_BOLD);
		RESULT_TOTAL.setHorizontalAlign(HorizontalAlign.CENTER);
		RESULT_TOTAL.setBorderTop(Border.PEN_1_POINT);
	}
	
	public static final Style RESULT_TOTAL_PAGE = new Style();
	static {
		RESULT_TOTAL_PAGE.setName("RESULT_TOTAL_PAGE");		
		RESULT_TOTAL_PAGE.setFont(Font.ARIAL_MEDIUM_BOLD);
		RESULT_TOTAL_PAGE.setHorizontalAlign(HorizontalAlign.RIGHT);
		RESULT_TOTAL_PAGE.setBorderTop(Border.PEN_1_POINT);
	}

}
